var data;
Ext.define('NIM.view.AssetDataMaster.AssetLandForm', {
    extend: 'Ext.panel.Panel',
    autoScroll: true,
    alias: 'widget.AssetLandForm',
    id: 'assetlandform',
    items: [
        {
            xtype: 'form',
            id: 'formAssetLand',
            region: 'west',
            margin: '5 5 5 5',
            method: 'POST',
            url: './Services/Asset/AssetLand/Update',
            listeners: {
                afterrender: function () {
                    setDataLand(category, site_id);
   
	              	var assetId = Ext.getCmp("assetIdLand").getValue();
					Ext.getStore('AssetDataMaster.AssetLandPbb').removeAll();
					Ext.getStore('AssetDataMaster.AssetLandPbb').getProxy().url = './Services/Asset/AssetLandPbb/List?assetId=' + assetId;
					Ext.getStore('AssetDataMaster.AssetLandPbb').load();
					Ext.getStore('AssetDataMaster.AssetLandPbb').on({
						load:function(){
						var store = Ext.getStore('AssetDataMaster.AssetLandPbb').getAt(0);
						if(store != null){
							Ext.getCmp('noobjpajak').setValue(store.get('PBB_NO'));
						}
					}
					});
                }
            },
            items: [
                {
                    xtype: 'fieldset',
                    columnWidth: 0.5,
                    title: 'Asset Land Common Info',
                    width: 770,
                    height: 240,
                    margin: '0 10 5 10',
                    items: [
                        {
                            xtype: 'hiddenfield',
                            cls: 'black',
                            id : 'assetIdLand',
                            name: 'ASSET_DETAIL_ID',
                            labelWidth: 130 / 1366 * screen.width,
                            width: 350 / 1366 * screen.width,
                            fieldLabel: 'Asset ID',
                            msgTarget: 'title',
                            allowBlank: true,
                            validateBlank: false

                        },
                        {
                            xtype: 'textfield',
                            cls: 'black',
                            id: 'siteidland',
                            name: 'SITE_ID',
                            margin: '0 10 5 5',
                            labelWidth: 130 / 1366 * screen.width,
                            width: 350 / 1366 * screen.width,
                            fieldLabel: 'Site ID',
                            msgTarget: 'title',
                            allowBlank: true,
                            validateBlank: false

                        },
                        {
                            xtype: 'textfield',
                            cls: 'black',
                            id: 'assetcategoryland',
                            name: 'CATEGORY',
                            margin: '5 10 5 5',
                            labelWidth: 130 / 1366 * screen.width,
                            width: 733 / 1366 * screen.width,
                            fieldLabel: 'Asset Category',
                            msgTarget: 'title',
                            allowBlank: true,
                            validateBlank: false

                        },
                        {
                            xtype: 'textfield',
                            cls: 'black',
                            id: 'assetcategorydescland',
                            margin: '5 10 5 5',
                            labelWidth: 130 / 1366 * screen.width,
                            width: 733 / 1366 * screen.width,
                            fieldLabel: 'Description',
                            msgTarget: 'title',
                            allowBlank: true,
                            validateBlank: false

                        },
                        {
                            xtype: 'panel',
                            border: false,
                            layout: {
                                type: 'table',
                                columns: 2
                            },
                            items: [{
                                    xtype: 'panel',
                                    width: 375,
                                    height: 200,
                                    border: false,
                                    margin: '0 10 0 0',
                                    items: [{
                                            xtype: 'combobox',
                                            cls: 'black',
                                            id: 'landstatus',
                                            name: 'LAND_STATUS',
                                            margin: '0 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Land Status',
                                            msgTarget: 'title',
                                            allowBlank: true,
                                            forceSelection: true,
                                            store: [['active', 'Active'], ['inactive', 'Inacvtive']]
                                        },
                                        {
                                            xtype: 'textfield',
                                            cls: 'black',
                                            id: 'landarea',
                                            name: 'LAND_AREA',
                                            margin: '5 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Land Area [m2]',
                                            msgTarget: 'title',
                                            allowBlank: true,
                                            validateBlank: false
                                        },
                                        {
                                            xtype: 'textfield',
                                            cls: 'black',
                                            id: 'ponumberland',
                                            name: 'PO_NUMBER',
                                            margin: '5 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Po No',
                                            msgTarget: 'title',
                                            allowBlank: true,
                                            validateBlank: false
                                        },
                                        {
                                            xtype: 'textfield',
                                            cls: 'black',
                                            id: 'bastland',
                                            name: 'BAST',
                                            margin: '5 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Bast',
                                            msgTarget: 'title',
                                            allowBlank: true,
                                            validateBlank: false
                                        },
                                        {
                                            xtype: 'combobox',
                                            cls: 'black',
                                            id: 'statusactiveland',
                                            name: 'STATUS',
                                            margin: '5 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Status',
                                            emptyText: 'Status',
                                            store: [['active', 'ACTIVE'], ['inactive', 'INACTIVE']],
                                            msgTarget: 'title',
                                            allowBlank: true,
                                            validateBlank: false
                                        }]
                                },
                                {
                                    xtype: 'panel',
                                    width: 375,
                                    border: false,
                                    height: 200,
                                    items: [
                                        {
                                            xtype: 'combobox',
                                            cls: 'black',
                                            id: 'assettelkomselland',
                                            name: 'ASSET_FLAG',
                                            margin: '0 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Asset Telkomsel',
                                            emptyText: 'Asset Telkomsel',
                                            msgTarget: 'title',
                                            msgTarget : 'title',
                                                    allowBlank: true,
                                            forceSelection: true,
                                            store: [['yes', 'Yes'], ['no', 'No']]
                                        },
                                        {
                                            xtype: 'textfield',
                                            cls: 'black',
                                            id: 'landpurpose',
                                            name: 'LAND_PURPOSE',
                                            margin: '5 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Land Purpose',
                                            msgTarget: 'title',
                                            allowBlank: true,
                                            validateBlank: false
                                        },
                                        {
                                            xtype: 'panel',
                                            border: false,
                                            height: 20

                                        },
                                        {
                                            xtype: 'textfield',
                                            cls: 'black',
                                            id: 'porcvnumberland',
                                            name: 'RCV_NUMBER',
                                            margin: '5 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Po Rcv No',
                                            msgTarget: 'title',
                                            allowBlank: true,
                                            validateBlank: false
                                        },
                                        {
                                            xtype: 'textfield',
                                            cls: 'black',
                                            id: 'referenceland',
                                            name: 'REFERENCE',
                                            margin: '5 10 5 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 350 / 1366 * screen.width,
                                            fieldLabel: 'Reference',
                                            msgTarget: 'title',
                                            allowBlank: true,
                                            validateBlank: false
                                        }]

                                }]


                        }]

                },
                {
                    xtype: 'fieldset',
                    columnWidth: 0.5,
                    title: 'Land Owner Info',
                    width: 770,
                    height: 75,
                    margin: '0 10 5 10',
                    //            layout : {
                    //		              type : 'table',
                    //		              columns : 2
                    //		            },
                    items: [{
                            xtype: 'panel',
                            width: 770,
                            heigth: 100,
                            layout: 'hbox',
                            border: false,
                            margin: '0 10 0 0',
                            items: [{
                                    xtype: 'textfield',
                                    cls: 'black',
                                    id: 'nameowner',
                                    name: 'LAND_OWNER',
                                    margin: '0 10 5 5',
                                    labelWidth: 130 / 1366 * screen.width,
                                    width: 350 / 1366 * screen.width,
                                    fieldLabel: 'Name',
                                    msgTarget: 'title',
                                    allowBlank: true,
                                    validateBlank: false
                                },
                                {
                                    xtype: 'textfield',
                                    cls: 'black',
                                    id: 'companyname',
                                    name: 'LAND_OWNER_COMPANY',
                                    margin: '0 10 5 23',
                                    labelWidth: 130 / 1366 * screen.width,
                                    width: 350 / 1366 * screen.width,
                                    fieldLabel: 'Company Name',
                                    msgTarget: 'title',
                                    allowBlank: true,
                                    validateBlank: false

                                }]
                        },
                        {
                            xtype: 'panel',
                            width: 770,
                            border: false,
                            items: [{
                                    xtype: 'textfield',
                                    cls: 'black',
                                    id: 'addressowner',
                                    name: 'LAND_OWNER_ADDRESS',
                                    margin: '0 10 5 5',
                                    labelWidth: 130 / 1366 * screen.width,
                                    width: 733 / 1366 * screen.width,
                                    fieldLabel: 'Address',
                                    msgTarget: 'title',
                                    allowBlank: true,
                                    validateBlank: false
                                }]


                        }]

                },
                {
                    xtype: 'fieldset',
                    columnWidth: 0.5,
                    title: 'Land Access Info',
                    width: 770,
                    height: 50,
                    margin: '0 10 5 10',
                    layout: 'hbox',
                    items: [{
                            xtype: 'combobox',
                            cls: 'black',
                            id: 'landacstatus',
                            name: 'LAND_ACCESS_STATUS',
                            margin: '0 10 5 5',
                            labelWidth: 130 / 1366 * screen.width,
                            width: 350 / 1366 * screen.width,
                            fieldLabel: 'Land Access Status',
                            msgTarget: 'title',
                            allowBlank: true
                        },
                        {
                            xtype: 'textfield',
                            cls: 'black',
                            id: 'accessarea',
                            name: 'LAND_ACCESS_AREA',
                            margin: '0 10 5 23',
                            labelWidth: 130 / 1366 * screen.width,
                            width: 350 / 1366 * screen.width,
                            fieldLabel: 'Access Area [m2]',
                            msgTarget: 'title',
                            allowBlank: true,
                            validateBlank: false

                        }]

                },
                {
                    xtype: 'fieldset',
                    columnWidth: 0.5,
                    title: 'Land Access Info',
                    width: 770,
                    height: 85,
                    margin: '0 10 5 10',
                    layout: 'hbox',
                    items: [
                        {
                            xtype: 'panel',
                            width: 365,
                            heigth: 100,
                            layout: 'vbox',
                            border: false,
                            margin: '0 10 0 0',
                            items: [
                                {
                                    xtype: 'panel',
                                    width: 365,
                                    heigth: 100,
                                    layout: 'hbox',
                                    border: false,
                                    margin: '0 10 0 0',
                                    items: [
                                        {
                                            xtype: 'textfield',
                                            fieldLabel: 'Land SHM/PKS',
                                            margin: '0 10 0 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 250 / 1366 * screen.width,
                                            name: 'fileLAND',
                                            buttonText: '...'
                                        },
                                        {
                                            xtype: 'button',
                                            width: 50,
                                            text: 'Upload',
                                            id: 'btnUploadLAND',
                                            margin: '5 10 0 5',
                                            handler: function () {

                                        	}
                                        }
                                    ]
                                },
                                {
                                    xtype: 'panel',
                                    width: 365,
                                    heigth: 100,
                                    layout: 'hbox',
                                    border: false,
                                    margin: '0 10 0 0',
                                    items: [
                                        {
                                            xtype: 'textfield',
                                            fieldLabel: 'LA SHM/PKS',
                                            margin: '0 10 0 5',
                                            labelWidth: 130 / 1366 * screen.width,
                                            width: 250 / 1366 * screen.width,
                                            name: 'fileLA',
                                            buttonText: '...'
                                        },
                                        {
                                            xtype: 'button',
                                            width: 50,
                                            text: 'Upload',
                                            id: 'btnUploadLA',
		                                    margin: '5 10 0 5',
                                            handler: function () {

                                            }
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            xtype: 'panel',
                            width: 385,
                            heigth: 150,
                            border: true,
                            layout: 'vbox',
                            border : false,
                            margin: '0 10 0 0',
                            items: [
                                
                                {
                                    xtype: 'panel',
                                    width: 385,
                                    heigth: 100,
                                    layout: 'hbox',
                                    border: false,
                                    margin: '0 10 0 0',
                                    items: [
                                        {
		                                    xtype: 'textfield',
		                                    cls: 'black',
		                                    id: 'noobjpajak',
		                                    margin: '5 10 0 5',
		                                    labelWidth: 130 / 1366 * screen.width,
		                                    width: 250 / 1366 * screen.width,
		                                    fieldLabel: 'No Obyek Pajak ',
		                                    msgTarget: 'title',
		                                    allowBlank: true,
		                                    validateBlank: false
		
		                                },
                                        {
                                            xtype: 'button',
                                            width: 50,
                                            text: 'Upload',
                                            id: 'btnUploadNOP',
		                                    margin: '5 10 0 5',
                                            handler: function () {
                                        		popupLandPbb();
                                            }
                                        }
                                    ]
                                },
                                {
                                    xtype: 'panel',
                                    width: 385,
                                    heigth: 140,
                                    layout: 'hbox',
                                    border: false,
                                    margin: '0 10 0 0',
                                    items: [
                                        {
                                            xtype: 'button',
                                            text: 'Update',
                                            id: 'btnUpdateLand',
                                            width: 60,
                                            height: 30,
                                            margin: '5 10 0 5',
                                            handler: function () {
                                                InputDataLand();
                                            }
                                        },
                                        {
                                            xtype: 'button',
                                            text: 'Cancel',
                                            id: 'btnCancelLand',
                                            width: 60,
                                            height: 30,
                                            margin: '5 10 0 5',
                                            handler: function () {
                                                Ext.getCmp('formAssetLand').getForm().setValues(data);
                                            }
                                        },
                		                {
                		                    xtype: 'button',
                		                    text: 'EXPORT TO PDF',
                		                    icon : 'images/pdf-icon-btn-btn.png',
                                            width: 105,
                                            height: 30,
                                            margin: '5 5 0 5',
                		                    handler: function () {
                	                			location.href = pdf+""+site_id;
                		                    }
                		                },
                		                {
                		                    xtype: 'button',
                		                    text: 'EXPORT TO EXCEL',
                		                    icon : 'images/Excel-icon-btn.png',
                                            width: 105,
                                            height: 30,
                                            margin: '5 5 0 5',
                		                    handler: function () {
                		                		location.href = xls+""+site_id;
                		                    }
                		                }
                                    ]
                                }
                            ]
                        }
                    ]

                }
            ]
        }

    ]

});